﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Text;
#endregion

namespace NetBay.Core.BusinessEntities
{
    [DataContract]
    /// <summary>
    /// Class handle a Setting (one row of r_paramgeneral table)
    /// <remarks>
    /// Columns :
    ///     Id          (integer)   : Automatic number to delete easyly a row
    ///     Name        (string)    : Name's setting
    ///     Description (string)    : Description's setting
    ///     Value       (string)    : Value's setting (ex : folder's path, enabled or not...)
    ///     Domain      (string)    : Domain's parameter. This help sort all settings (ex : PARAM, FLOW, SOCIETE…)
    /// </remarks>
    /// </summary>
    public class Setting : ReturnObject
    {
        #region Enum
        /// <summary>
        /// List of DB functions to access data
        /// </summary>
        [DataContract]
        public enum Column
        {
            [DescriptionAttribute("RP_GE_ID")]
            Id,
            [DescriptionAttribute("RP_GE_NOM")]
            Name,
            [DescriptionAttribute("RP_GE_DESCRIPTION")]
            Description,
            [DescriptionAttribute("RP_GE_VALEUR")]
            Value,
            [DescriptionAttribute("RP_GE_DOMAINE")]
            Domain,
        }
        #endregion

        #region Private members

        /// <summary>
        /// Automatic number to delete easyly a row
        /// </summary>
        private int m_iId;
        [DataMember]
        public int iId
        {
            get { return m_iId; }
            set { m_iId = value; }
        }

        /// <summary>
        /// Name's setting
        /// </summary>
        private string m_szName;
        [DataMember]
        public string szName
        {
            get { return m_szName; }
            set { m_szName = value; }
        }

        /// <summary>
        /// Description's setting
        /// </summary>
        private string m_szDescription;
        [DataMember]
        public string szDescription
        {
            get { return m_szDescription; }
            set { m_szDescription = value; }
        }

        /// <summary>
        /// Value's setting (ex : folder's path, enabled or not...)
        /// </summary>
        private object m_szValue;
        [DataMember]
        public object szValue
        {
            get { return m_szValue; }
            set { m_szValue = value; }
        }

        /// <summary>
        /// Domain's parameter. This help sort all settings (ex : PARAM, FLOW, SOCIETE…)
        /// </summary>
        private string m_szDomain;
        [DataMember]
        public string szDomain
        {
            get { return m_szDomain; }
            set { m_szDomain = value; }
        }

        #endregion


        #region ToString
        /// <summary>
        /// Extend default description of class
        /// </summary>
        /// <returns>description of instance</returns>
        public override string ToString()
        {
            StringBuilder parameters = new StringBuilder("iId<", 4096);
            parameters.Append(iId); parameters.Append("> ");
            parameters.Append("szDomain<"); parameters.AppendFormat("{0,-24}", szDomain); parameters.Append("> ");
            parameters.Append("szName<"); parameters.AppendFormat("{0,-32}", szName); parameters.Append("> ");
            parameters.Append("szDescription<"); parameters.Append(szDescription); parameters.Append("> ");
            parameters.Append("szValue<"); parameters.Append(szValue); parameters.Append("> ");

            return parameters.ToString();
        }
        #endregion


        public override object Clone()
        {
            throw new NotImplementedException();
        }
    }
}

